package br.com.edoc.util.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.convert.FacesConverter;

import br.com.edoc.util.TratamentoString;
@FacesConverter( value="stringUperCase" )
public class StringUperCaseConverter implements Converter{

	@Override
	public Object getAsObject(FacesContext context, UIComponent componente, String value) throws ConverterException {
		// TODO Auto-generated method stub
		if(value != null){
			value = TratamentoString.removeEspacamentoDuploDeixaCaixaAlta(value);
		}
		return value;
	}

	@Override
	public String getAsString(FacesContext context, UIComponent componente, Object value) throws ConverterException{
		// TODO Auto-generated method stub
		if(value != null){
			value = TratamentoString.removeEspacamentoDuploDeixaCaixaAlta((String) value);
		}
		return (String) value;
	}

}
